<?php
/*
 * 门面模式
 * 举例：买股票
 */
class AL{
    function buy(){
        echo "buy阿里".PHP_EOL;
    }
    function sell(){
        echo "sell阿里".PHP_EOL;
    }
}
class JD{
    function buy(){
        echo "buy京东".PHP_EOL;
    }
    function sell(){
        echo "sell京东".PHP_EOL;
    }
}
class TX{
    function buy(){
        echo "buy TX".PHP_EOL;
    }
    function sell(){
        echo "sell TX".PHP_EOL;
    }
}
class factory{
    private $al;
    private $jd;
    private $tx;
    function __construct()
    {
        $this->al = new AL();
        $this->jd = new JD();
        $this->tx = new TX();
    }
    function buy(){
        $this->al->buy();
    }
    function sell(){
        $this->jd->sell();
        $this->tx->sell();
    }
}
$factory = new factory();
$factory->buy();
$factory->sell();